import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

data = "../../data_in/1server_result_(T100N100).xlsx"

avail = pd.read_excel(data, index_col=0).iloc[0].to_list()
avail = avail[:-1]

x = [i + 1 for i in range(100)]
y_rc = [0.9999908673296938 for i in range(100)]
y_bdd = [0.9999908676007585 for i in range(100)]
y = []
for i in range(len(avail)):
    y.append(np.mean(avail[:(i + 1)]))

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
plt.plot(x, y)
plt.plot(x, y_rc)
plt.plot(x, y_bdd)
ax.get_yaxis().get_major_formatter().set_scientific(False)
ax.set_xlabel("i")
ax.set_ylabel("availability")
